import Model from '@/api/model'
import { request } from '@/api/request'
import { fromData } from '@/api/decorators/transform-data'

class AccountModel extends Model {
  constructor (config) {
    super(config)
    this.apiName = 'api'
  }

  login (params) {
    return request({
      type: 'post',
      apiName: this.apiName,
      path: '/users/login',
      params
    })
  }

  @fromData
  currentInfo () {
    return request({
      apiName: this.apiName,
      path: '/users/get'
    })
  }
}

export const Account = new AccountModel()
